{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf320
{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fnil\fcharset0 Monaco;}
{\colortbl;\red255\green255\blue255;\red63\green95\blue191;\red127\green159\blue191;\red127\green0\blue85;
\red0\green0\blue192;\red63\green127\blue95;}
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural

\f0\fs24 \cf0 Task 5- Summing it All Up\
\

\b \ul Previous Tasks
\b0 \
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
\cf0 \ulc0 Task 2- Fibonacci\
\ulnone \
This task was very simple. When running the jUnit tester, we saw that the expected assertion should be '0' but we received a '1'. In looking at the Fibonacci.java we could see in the switch statement that if the case was '0' to return a '1'. Hence our problem. Changing the return value from a '1' to a '0' fixed the bug, and then the jUnit test ran smoothly with no errors.\
\
\ul Task 3- Rectangle\ulnone \
\
2.  Fixing the Bug\
This task was very simple. When running the jUnit tester, we saw that the expected assertion should be a double of 10.0 but we received a 25.0. This lead me to believe that there was bug regarding the doubles that were beings used to create points. Indeed, this was the case. In the Point.java, this.x was set to the y value that was passed in. Changing "this.x = y" to "this.x = x" and then running the jUnit test produces no failures.\
\
3. Modified Methods\
For modifying the methods I included some method comments as well as split up the return statement into a number of logical steps.\
\pard\pardeftab720

\f1\fs22 \cf0 	\cf2 /**\cf0 \
\cf2 	 * Gets the area.\cf0 \
\cf2 	 * \cf0 \
\cf2 	 * Uses two global Point objects and their respective x and y coordinates\cf0 \
\cf2 	 * to calculate the rectangle's area\cf0 \
\cf2 	 *\cf0 \
\cf2 	 * \cf3 @return\cf2  the area\cf0 \
\cf2 	 */\cf0 \
	\cf4 public\cf0  Double getArea() \{\
		Double xDiff = \cf5 p2\cf0 .\cf5 x\cf0  - \cf5 p1\cf0 .\cf5 x\cf0 ;\
		Double yDiff = \cf5 p2\cf0 .\cf5 y\cf0  - \cf5 p1\cf0 .\cf5 y\cf0 ;\
		Double area = Math.abs(xDiff*yDiff);\
		\
		\cf6 //return Math.abs((p2.x - p1.x) * (p2.y - p1.y));\cf0 \
		\cf4 return\cf0  area;\
	\}\
	\
	\cf2 /**\cf0 \
\cf2 	 * Gets the diagonal.\cf0 \
\cf2 	 * \cf0 \
\cf2 	 * Uses two global Point objects and their respective x and y coordinates\cf0 \
\cf2 	 * to calculate the rectangle's diagonal line\cf0 \
\cf2 	 *\cf0 \
\cf2 	 * \cf3 @return\cf2  the diagonal\cf0 \
\cf2 	 */\cf0 \
	\cf4 public\cf0  Double getDiagonal() \{\
		Double xDiff = \cf5 p2\cf0 .\cf5 x\cf0  - \cf5 p1\cf0 .\cf5 x\cf0 ;\
		Double yDiff = \cf5 p2\cf0 .\cf5 y\cf0  - \cf5 p1\cf0 .\cf5 y\cf0 ;\
		Double xPow = Math.pow(xDiff, 2);\
		Double yPow = Math.pow(yDiff, 2);\
		Double diagonal = Math.sqrt(xPow + yPow);\
		\
		\cf6 //return Math.sqrt(Math.pow((p2.x - p1.x), 2) + Math.pow((p2.y - p1.y), 2));\cf0 \
		\cf4 return\cf0  diagonal;\
	\}\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural

\f0\fs24 \cf0 \ul \ulc0 Task 4-Vending Machine\ulnone \
\
I wasn't particularly searching for bugs, but noticed that there are a couple instances in which methods don't explain that there can be a thrown exception. For instance, the makePurchase method in VendingMachine does not throw an exception if an incorrect slot letter is selected.\
\

\b \ul Task 5 WriteUps\

\b0 \ulnone \
\ul What I Learned\ulnone \
This project was a very good project to understand aspects of the jUnit testing. The first two tasks aided in providing a basis for reviewing the reports generated jUnit, and the last task required the implementation of jUnit tests for each of the two vending machine files. \
\
The vending machine task was particularly difficult compared to the other tasks in that it required understanding how to create simple tests like in the previous tasks, but also required outside work in search the internet on how to do different assertions. Simply changing some values in the assertEquals call caused an error of using a deprecated method. After doing a google search, I found there are quite a variety of assertEquals statements as well as a number of others that I would need for other test cases. These include checking for boolean values and comparing double variables.\
\
\ul What I Liked\
\ulnone There really wasn't anything I disliked about jUnit. I'm familiar with qUnit, so I kind of understood the concept of unit testing, but this was a little different. I liked that I could create a test at a time and run it, and then gradually build on the tests for each class. I especially liked the jUnit suite. This is really nifty for running all the tests I created in both test classes.\
\
I also liked the API documentation for jUnit that I found on the web. Their documentation was very good, clear, and easy to understand. This made creating tests quick and painless. I was able to quickly see that one of my assert statements was deprecated, and find alternative solutions.\
\
}